﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;


public partial class admin_cms_EditMenu : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Session["timeout"] == null)
            {
                Response.Redirect("login.aspx");
            }
            {
                string idmenu = Request.QueryString.Get("IdMenu");
                if (idmenu == "")
                {
                    Response.Redirect("admin_manager_menu.aspx");
                }
                else
                {
                    DataTable dtthemmenu = new DataTable();
                    dtthemmenu = DataAccess.ExeSQLToDataTable("select * from dev_menu where idmenu='" + idmenu + "'");
                    if (dtthemmenu.Rows.Count > 0)
                    {
                        txtname_menu.Text = dtthemmenu.Rows[0][2].ToString();
                    }
                    Session.Add("idmenu", idmenu);
                }
            }
        }
    }
    protected void suamenu_click(object sender, EventArgs e)
    {
        string namemenu = txtname_menu.Text;
        string idmenu = Session["idmenu"].ToString();
        string sqlupdate = "update dev_menu set name_menu =N'"+namemenu+"' where idmenu='"+idmenu+"' ";
        DataAccess.ExeNonSQL(sqlupdate);
        Response.Write("<script>alert('Bạn sửa menu thành công !')</script>");
        Response.Redirect("admin_manager_menu.aspx");

    }
}
